package com.learner.course.controller.api;


import com.learner.course.service.CourseDetailService;
import com.learner.pojo.course.CourseDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Description: 课程详细 数据接口
 * @Author: ice2020x
 * @Date: 2021/11/12
 */
@RestController
@RequestMapping("/api/edu/detail")
public class ApiCourseDetailController {

    @Autowired
    private CourseDetailService detailService;

    /**
     * 保存课程的概述信息
     *
     * @param courseDetail 详细描述
     */
    @PostMapping("/save")
    public void save(@RequestBody CourseDetail courseDetail) {
        detailService.save(courseDetail);
    }

    /**
     * 获取课程的概述信息
     *
     * @param courseId 课程id
     * @return 结果
     */
    @GetMapping("/get/{courseId}")
    public List<Map<String, String>> getCourseDetailByCourseId(@PathVariable("courseId") String courseId) {
        return detailService.getCourseDetailByCourseId(courseId);
    }
}
